/*
**                         Copyright 2002 by KVASER AB            
**                   P.O Box 4076 SE-51104 KINNAHULT, SWEDEN
**                          WWW: http://www.kvaser.com
**
** This software is furnished under a license and may be used and copied
** only in accordance with the terms of such license.
**
** Description:
**  JavaScript that can turn on or off resource filtering for the LAPcan driver
**  (3.3 or later).
**
**  The 3.3 driver uses resource filtering to ensure the I/O address lies between
**  0 and 0x3FF.
**
** ---------------------------------------------------------------------------
*/

var shell = WScript.CreateObject("WScript.Shell");

var retval = shell.Popup(
"This script can enable or disable resource filtering for " +
"the LAPcan driver.  It is normally enabled. " +
"Please consult support@kvaser.com before changing the " +
"resource filtering.\n" +
"Press Yes to enable resource filtering, " +
"No to disable it, or Cancel to quit " +
"without changing the current value.", 
                        
                          0, "LAPcan Resource Filtering", 3);

switch (retval) {
   case 6:
       // Yes
       shell.RegWrite ("HKLM\\Software\\KVASER AB\\CANdriver 1.0\\Options\\LAPcanNoAddressRestriction", 0, "REG_DWORD");
       break;
   case 7:
       // No
       shell.RegWrite ("HKLM\\Software\\KVASER AB\\CANdriver 1.0\\Options\\LAPcanNoAddressRestriction", 1, "REG_DWORD");
       break;
   default:
       break;
}
